package top.yudoge.dogeeditor.llm.config.models

import dev.langchain4j.community.model.dashscope.QwenChatModel.QwenChatModelBuilder
import dev.langchain4j.community.model.dashscope.QwenStreamingChatModel.QwenStreamingChatModelBuilder
import dev.langchain4j.model.chat.ChatLanguageModel
import dev.langchain4j.model.chat.StreamingChatLanguageModel
import top.yudoge.dogeeditor.llm.config.LargeLanguageModelProperties

class QWenModelInitializer : ModelInitializer {

    override fun initializeStreamModel(properties: LargeLanguageModelProperties): StreamingChatLanguageModel {
        return QwenStreamingChatModelBuilder()
            .modelName(properties.modelName)
            .apiKey(properties.apiKey)
            .build();
    }

    override fun initializeChatModel(properties: LargeLanguageModelProperties): ChatLanguageModel {
        return QwenChatModelBuilder()
            .modelName(properties.modelName)
            .apiKey(properties.apiKey)
            .build();
    }

    override fun support(modelName: String): Boolean {
        return modelName in SUPPORTED_MODEL_LIST
    }

    companion object {
        private val SUPPORTED_MODEL_LIST = listOf("qwen-coder-turbo", "qwen3-coder-plus", "qwen2.5-coder-7b-instruct", "qwen-max", "qwen-plus")
    }

}